<!DOCTYPE html>
<html class="no-js">
    
    <head>
        <title>商铺管理</title>
        <!-- Bootstrap -->
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
        <link href="vendors/easypiechart/jquery.easy-pie-chart.css" rel="stylesheet" media="screen">
        <link href="assets/styles.css" rel="stylesheet" media="screen">
        <link href="assets/DT_bootstrap.css" rel="stylesheet" media="screen">
        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <script src="vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
        
        <link href="assets/DT_bootstrap.css" rel="stylesheet" media="screen">
   

    </head>
    
    <body>
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="#">商铺管理</a>
                    <div class="nav-collapse collapse">
                        <ul class="nav pull-right">
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-user"></i> 设置 <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                         <a href="binding.html"><i class="icon-chevron-right"></i>商铺信息设置 </a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a tabindex="-1" href="login.html">安全退出</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                        <ul class="nav">
                            <li class="active">
                                <a href="#" onclick="refresh();">商铺信息</a>
                            </li>
                            <li class="dropdown">
                                <a href="#" data-toggle="dropdown" class="dropdown-toggle">设置 <b class="caret"></b>

                                </a>
                                <ul class="dropdown-menu" id="menu1">
                                    
                               
                                    <li>
                                        <a href="#" onclick="javascript:gotoPage('binding');" >修改邮箱</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a href="#" onclick="javascript:gotoPage('update');">修改密码</a>
                                    </li>
                           
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Content <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a tabindex="-1" href="#">Blog</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">News</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Custom Pages</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Calendar</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a tabindex="-1" href="#">FAQ</a>
                                    </li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Users <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a tabindex="-1" href="#">User List</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Search</a>
                                    </li>
                                    <li>
                                        <a tabindex="-1" href="#">Permissions</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <!--/.nav-collapse -->
                </div>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span3" id="sidebar">
                    <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                        <li class="active">
                            <a href="#" onclick="refresh();" id="storeInfo"><i class="icon-chevron-right"></i> 商品</a>
                        </li>
                      
                        <li>
                            <a href="binding.html"><i class="icon-chevron-right"></i> 设置</a>
                        </li>
                       
                        <li>
                            <a href="order.html"><i class="icon-chevron-right"></i>订单</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-success pull-right">812</span> Invoices</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">27</span> Clients</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">1,234</span> Users</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">2,221</span> Messages</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-info pull-right">11</span> Reports</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-important pull-right">83</span> Errors</a>
                        </li>
                        <li>
                            <a href="#"><span class="badge badge-warning pull-right">4,231</span> Logs</a>
                        </li>
                    </ul>
                </div>
                
               
                
                <!--/span-->
                <div class="span9" id="content">
                    <div class="row-fluid">
                        <div class="alert alert-success">
							<button type="button" class="close" data-dismiss="alert">&times;</button>
                            <h4>您好！</h4>
                        	欢迎登录，商铺管理系统~~~</div>
                        <div id="dir">
                        	<div class="navbar">
                            	<div class="navbar-inner">
	                                <ul class="breadcrumb">
	                                    <i class="icon-chevron-left hide-sidebar"><a href='#' title="Hide Sidebar" rel='tooltip'>&nbsp;</a></i>
	                                    <i class="icon-chevron-right show-sidebar" style="display:none;"><a href='#' title="Show Sidebar" rel='tooltip'>&nbsp;</a></i>
	                                    <li >
	                                        <a href="#" onclick="showPage();" id="dir_first">商铺管理</a> <span class="divider">/</span>	
	                                    </li>
	                                    <li >
	                                        <a href="#" id="dir_second">信息查询</a> <span class="divider">/</span>	
	                                    </li>
	                                    <li class="active" id="dir_third">商品信息</li>
	                                </ul>
                            	</div>
                        	</div>
                        </div>
                        
                         <p hidden="hidden" id="myImg"><img src="images/mybg.jpg"></p>
                        
                    	</div>
                   
                    
                     <div id="myFoodTable">
                    <div class="row-fluid">
                        <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left">所有商品</div>
                            </div>
                            <div class="block-content collapse in">
                                <div class="span12">
                                   <div class="table-toolbar">
                                      <div class="btn-group">
                                         <a href="#" onclick="addFood();"><button class="btn btn-success">添加商品 <i class="icon-plus icon-white"></i></button></a>
                                      </div>
                                   </div>
                                    
                                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example2">
                                        <thead>
                                            <tr>
                                                
                                                <th>编号</th>
                                                <th>商品</th>
                                                <th>商品名称</th>
                                                <th>商品价格</th>
                                                <th>商品数量</th>
                                                <th>商品介绍</th>
                                            </tr>
                                        </thead>
                                        <tbody id="main">
                                           
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <!-- /block -->
                    </div>
        
        </div>
                    
            <div id="myOrderTable">
                    <div class="row-fluid">
                        <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left">所有订单</div>
                            </div>
                            <div class="block-content collapse in">
                                <div class="span12">
                                   
                                    
                                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example2">
                                        <thead>
                                            <tr>
                                                <th>编号</th>
                                                <th>订购时间</th>
                                                <th>收货人</th>
                                                <th>总价</th>
                                                <th>商品编号</th>
                                                <th>收货地址</th>
                                            </tr>
                                        </thead>
                                        <tbody id="ordermain">
                                           
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <!-- /block -->
                    </div>
        
        </div>
                     <div id="myAddFood">
        
             <div class="row-fluid">
                      
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                
                               
                                <div class="muted pull-left">添加商品</div>
                          
                            </div>
                             <div class="block-content collapse in">
                                <div class="span12">
                                    <form class="form-horizontal" action="addFood" enctype="multipart/form-data" method="post">
                                      <fieldset>
                                        <legend>填写商品的详细信息</legend>
                                        <div class="control-group">
                                          <label class="control-label" for="typeahead">商品名： </label>
                                          <div class="controls">
                                            <input type="text" class="span6" name="commodityName"  data-provide="typeahead" data-items="4" >
                                            <p class="help-block">请填写完整的名称</p>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="date01">输入数量：</label>
                                          <div class="controls">
                                            <input type="text" class="input-xlarge datepicker" id="date01" name="commodiryNum">
                                            <p class="help-block">请输入库存数量，数据必须是整数.</p>
                                          </div>
                                        </div>
                                          <div class="control-group">
                                          <label class="control-label" for="date01">输入价格：</label>
                                          <div class="controls">
                                            <input type="text" class="input-xlarge datepicker" id="date01" name="commodityPrice">
                                            <p class="help-block">请输入商品价格，数据必须是整数.</p>
                                          </div>
                                        </div>
                                          <div class="control-group">
                                          <label class="control-label" for="typeahead">商品编号： </label>
                                          <div class="controls">
                                            <input type="text" class="span6" name="commodityCode"  data-provide="typeahead" data-items="4" >
                                            <p class="help-block">谨慎输入!</p>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="optionsCheckbox">商品状态：</label>
                                          <div class="controls">
                                            <label class="uniform">
                                              <input class="uniform_on" type="checkbox" id="optionsCheckbox" value="1" name="commodiryStatus">
                                              是否上架，勾选表示上架
                                            </label>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="select01">商品折扣：</label>
                                          <div class="controls">
                                            <select id="select01" class="chzn-select" name="commodityDiscount">
                                              <option value="1">不打折</option>
                                              <option value="0.9">9折</option>
                                              <option value="0.8">8折</option>
                                              <option value="0.7">7折</option>
                                              <option value="0.5">5折</option>
                                            </select>
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="multiSelect">选择类型：</label>
                                          <div class="controls">
                                            <select multiple="multiple" id="multiSelect" class="chzn-select span4" name="commodityType">
                                              <option>水果</option>
                                              <option>家具</option>
                                              <option>食品</option>
                                              <option>家电</option>
                                            </select>
                                          
                                          </div>

                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="fileInput">选择图片：</label>
                                          <div class="controls">
                                            <input class="input-file uniform_on" id="fileInput" type="file" name="pictureUri">
                                          </div>
                                        </div>
                                        <div class="control-group">
                                          <label class="control-label" for="textarea2">商品描述：</label>
                                          <div class="controls">
                                            <textarea class="input-xlarge textarea" placeholder="请输入描述信息 ..." style="width: 810px; height: 200px" name="commodityTip"></textarea>
                                          </div>
                                        </div>
                                        <div class="form-actions">
                                          <button type="submit" class="btn btn-primary">提交</button>
                                          <button type="reset" class="btn">重置</button>
                                        </div>
                                      </fieldset>
                                    </form>

                                </div>
                            </div>
                        </div> 
                        
                    </div> 
        
             
        
        </div>
    
            <hr>
            <footer style="margin-bottom: 20px;">
                <p>&copy; 木小草  && 木蔷薇     </p><p>商家管理系统，采用JMS消息队列传输信息，Bootstrap前端框架，JQuery异步交互，完全独立的管理系统</p>
            </footer>
        </div> 
        <!--/.fluid-container-->
        <script src="vendors/jquery-1.9.1.min.js"></script>
        <script src="bootstrap/js/bootstrap.min.js"></script>
        <script src="vendors/easypiechart/jquery.easy-pie-chart.js"></script>
        <script src="assets/scripts.js"></script>
                
        <script src="vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
        <script src="vendors/datatables/js/jquery.dataTables.min.js"></script>
         <!--<script src="assets/DT_bootstrap.js"></script>-->
        
       


                
        <script>
            var comm = null;
            var myFoodTable = $("#myFoodTable");
            var myAddFood = $("#myAddFood");
            var main = $("#main");
            var ordermain = $("#ordermain");
            var myImg = $("#myImg")
            var myOrderTable = $("#myOrderTable");
            
            /*初始化参数*/
            var myDataAll;
            var dir_first = $("#dir_first");
            var dir_second = $("#dir_second");
            var dir_third = $("#dir_third");
        
            var mydiv = $("#mydiv");
            var dir = $("#dir");
            var alertsuccess = $(".alertsuccess");
            
        function downloadJSAtOnload() {
                var element = document.createElement("script");
                element.src = "assets/DT_bootstrap.js";
                document.body.appendChild(element);
            }
            if (window.addEventListener)
                window.addEventListener("load", downloadJSAtOnload, false);
            else if (window.attachEvent)
                window.attachEvent("onload", downloadJSAtOnload);
            else window.onload = downloadJSAtOnload;
        
        myAddFood.hide();
        myOrderTable.hide();
            dir_second.hide();
            /* 显示订单 */
				 $.getJSON(
						"showOrder",
						function(data) {
                            if(data == null) {
                                alert("还没有订单");
                            }
						    comm=data;
                         
							for (var i = 0; i < data.length; i++) {
                                

								var status = null;
                                ordermain.append("<tr><td>" + data[i]['orderId']+"</td><td>"+ 
                                           data[i]['orderTIme']+"</td><td>"+ 
                                           data[i]['receiver']+"</td><td>"+
                                            data[i]['money']+"</td><td>"+
                                            data[i]['commodityId']+"</td><td>"+
                                            data[i]['orderAddress']+"</td></tr>"    
                                );

							}
						});
        
      /* 显示商品 */
				 $.getJSON(
						"showFood",
						function(data) {
                            if(data == null) {
                                alert("还没有商品");
                            }
						    comm=data;
                         
							for (var i = 0; i < data.length; i++) {
                                

								var status = null;
                                main.append("<tr><td>" + data[i]['commodityCode']+ "</td><td> <img src='"+
                                           data[i]['pictureUri']+"'></td><td>"+ 
                                           data[i]['commodityName']+"</td><td>"+
                                            data[i]['commodityPrice']+"</td><td>"+
                                            data[i]['commodiryNum']+"</td><td>"+
                                            data[i]['commodityTip']+"</td></tr>"    
                                );

							}
						});
		
        function addFood() {
            myFoodTable.hide();
            myAddFood.show();
            myImg.hide();
            mydiv.hide();
            myOrderTable.hide();
            
            dir_second.show();
            dir_third.show();
            dir_second.text("商品信息");
            dir_third.text("添加商品");
            dir_second.attr("href","javascript:gotoShow();");
                
            
        }
        function gotoShow() {
         
            myFoodTable.show();
            myAddFood.hide();
            myImg.hide();
            myOrderTable.hide();
        
            dir_second.hide();
            dir_third.text("商品信息");
       
            dir_second.attr("href","javascript:refresh();");
                
        }
        function orderShow() {
            myFoodTable.hide();
            myOrderTable.show();
            myAddFood.hide();
            myImg.hide();
       
        
            dir_second.hide();
            dir_third.text("订单信息");
       
            dir_second.attr("href","javascript:refresh();");
        }
           
            
           /*----------------------------*/
    
           /*打开商家信息目录*/
           function refresh() {
               myImg.hide();
               myFoodTable.show();
               myAddFood.hide();
               myOrderTable.hide();
               
                dir_second.hide();
               dir_third.text("商品信息");
                dir_third.show();
               mydiv.show();
               dir.show();
           }
            
            /*主页*/
            function showPage() {
                
                dir.hide();
                myImg.show();
                myFoodTable.hide();
                myAddFood.hide();
                mydiv.hide();
                myOrderTable.hide();
                /*alert-success.*/
            }
            
            /*页面跳转*/
            function gotoPage(data) {
                window.location.href='binding.html?actionCode='+data;  
            }
            
            /*定时获得数据*/
             $(function() {
                
                run();
                var interval;
                function run() {
                    interval = setInterval(chat,5000);
                }
                function chat() {
                    $.getJSON("newNumber",function(data){
                    
                        if(data!=0) {
                            
                            alert("有" + data + "条新账单，请刷新页面查看");
                        }
                    })
                }
                
            })
      
        </script>
        
    </body>

</html>